/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import da.AccountJpaController;
import entities.Account;
import entities.Manager;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import javax.persistence.TypedQuery;

/**
 *
 * @author QUY_THI
 */
@Stateless
public class Accounts implements AccountsLocal {

    public List<Account> getAllAccount() {
        EntityManager em = Persistence.createEntityManagerFactory("eBanking-ejbPU").createEntityManager();
        String sql = "select a from Account a";
        TypedQuery<Account> query = em.createQuery(sql, Account.class);
        return query.getResultList();
    }
}
